package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "contact_", schema = "crm")
public class Contact {
    private int contactId;
    private String contactName;
    private String contactPhone;
    private Integer contactType;
    private String contactSex;
    private String contactBusiness;
    private String contactContacttype;
    private String contactDept;
    private String contactDuty;
    private String contactQq;
    private String contactQqname;
    private String contactWechat;
    private String contactWechatname;
    private String contactAddress;
    private String contactTip;
    private String contactDetailAaddress;
    private Customer customerByCustomerId;

    @Id
    @Column(name = "contact_id", nullable = false)
    public int getContactId() {
        return contactId;
    }

    public void setContactId(int contactId) {
        this.contactId = contactId;
    }


    @Basic
    @Column(name = "contact_name", nullable = true, length = 255)
    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    @Basic
    @Column(name = "contact_phone", nullable = true, length = 255)
    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    @Basic
    @Column(name = "contact_type", nullable = true)
    public Integer getContactType() {
        return contactType;
    }

    public void setContactType(Integer contactType) {
        this.contactType = contactType;
    }

    @Basic
    @Column(name = "contact_sex", nullable = true, length = 255)
    public String getContactSex() {
        return contactSex;
    }

    public void setContactSex(String contactSex) {
        this.contactSex = contactSex;
    }

    @Basic
    @Column(name = "contact_business", nullable = true, length = 255)
    public String getContactBusiness() {
        return contactBusiness;
    }

    public void setContactBusiness(String contactBusiness) {
        this.contactBusiness = contactBusiness;
    }

    @Basic
    @Column(name = "contact_contacttype", nullable = true, length = 255)
    public String getContactContacttype() {
        return contactContacttype;
    }

    public void setContactContacttype(String contactContacttype) {
        this.contactContacttype = contactContacttype;
    }

    @Basic
    @Column(name = "contact_dept", nullable = true, length = 255)
    public String getContactDept() {
        return contactDept;
    }

    public void setContactDept(String contactDept) {
        this.contactDept = contactDept;
    }

    @Basic
    @Column(name = "contact_duty", nullable = true, length = 255)
    public String getContactDuty() {
        return contactDuty;
    }

    public void setContactDuty(String contactDuty) {
        this.contactDuty = contactDuty;
    }

    @Basic
    @Column(name = "contact_qq", nullable = true, length = 255)
    public String getContactQq() {
        return contactQq;
    }

    public void setContactQq(String contactQq) {
        this.contactQq = contactQq;
    }

    @Basic
    @Column(name = "contact_qqname", nullable = true, length = 255)
    public String getContactQqname() {
        return contactQqname;
    }

    public void setContactQqname(String contactQqname) {
        this.contactQqname = contactQqname;
    }

    @Basic
    @Column(name = "contact_wechat", nullable = true, length = 255)
    public String getContactWechat() {
        return contactWechat;
    }

    public void setContactWechat(String contactWechat) {
        this.contactWechat = contactWechat;
    }

    @Basic
    @Column(name = "contact_wechatname", nullable = true, length = 255)
    public String getContactWechatname() {
        return contactWechatname;
    }

    public void setContactWechatname(String contactWechatname) {
        this.contactWechatname = contactWechatname;
    }

    @Basic
    @Column(name = "contact_address", nullable = true, length = 255)
    public String getContactAddress() {
        return contactAddress;
    }

    public void setContactAddress(String contactAddress) {
        this.contactAddress = contactAddress;
    }

    @Basic
    @Column(name = "contact_tip", nullable = true, length = 255)
    public String getContactTip() {
        return contactTip;
    }

    public void setContactTip(String contactTip) {
        this.contactTip = contactTip;
    }

    @Basic
    @Column(name = "contact_detail_aaddress", nullable = true, length = 255)
    public String getContactDetailAaddress() {
        return contactDetailAaddress;
    }

    public void setContactDetailAaddress(String contactDetailAaddress) {
        this.contactDetailAaddress = contactDetailAaddress;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Contact contact = (Contact) o;
        return contactId == contact.contactId &&
                Objects.equals(contactName, contact.contactName) &&
                Objects.equals(contactPhone, contact.contactPhone) &&
                Objects.equals(contactType, contact.contactType) &&
                Objects.equals(contactSex, contact.contactSex) &&
                Objects.equals(contactBusiness, contact.contactBusiness) &&
                Objects.equals(contactContacttype, contact.contactContacttype) &&
                Objects.equals(contactDept, contact.contactDept) &&
                Objects.equals(contactDuty, contact.contactDuty) &&
                Objects.equals(contactQq, contact.contactQq) &&
                Objects.equals(contactQqname, contact.contactQqname) &&
                Objects.equals(contactWechat, contact.contactWechat) &&
                Objects.equals(contactWechatname, contact.contactWechatname) &&
                Objects.equals(contactAddress, contact.contactAddress) &&
                Objects.equals(contactTip, contact.contactTip) &&
                Objects.equals(contactDetailAaddress, contact.contactDetailAaddress);
    }

    @Override
    public int hashCode() {
        return Objects.hash(contactId,contactName, contactPhone, contactType, contactSex, contactBusiness, contactContacttype, contactDept, contactDuty, contactQq, contactQqname, contactWechat, contactWechatname, contactAddress, contactTip, contactDetailAaddress);
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }

    @Override
    public String toString() {
        return "Contact{" +
                "contactId=" + contactId +
                ", contactName='" + contactName + '\'' +
                ", contactPhone='" + contactPhone + '\'' +
                ", contactType=" + contactType +
                ", contactSex='" + contactSex + '\'' +
                ", contactBusiness='" + contactBusiness + '\'' +
                ", contactContacttype='" + contactContacttype + '\'' +
                ", contactDept='" + contactDept + '\'' +
                ", contactDuty='" + contactDuty + '\'' +
                ", contactQq='" + contactQq + '\'' +
                ", contactQqname='" + contactQqname + '\'' +
                ", contactWechat='" + contactWechat + '\'' +
                ", contactWechatname='" + contactWechatname + '\'' +
                ", contactAddress='" + contactAddress + '\'' +
                ", contactTip='" + contactTip + '\'' +
                ", contactDetailAaddress='" + contactDetailAaddress + '\'' +
                ", customerByCustomerId=" + customerByCustomerId +
                '}';
    }
}
